import path from "node:path";
import fs from "node:fs";

// import { defineApplicationConfig } from "./application"
// import { defineLibraryConfig } from "./library"
// import type { DefineLibraryOptions, DefineApplicationOptions } from "../types"

/**
 *
 * @param userConfigPromise
 * @param type
 */
// export function defineConfig(
//     userConfigPromise?: DefineApplicationOptions | DefineLibraryOptions,
//     type: "auto" | "application" | "library" = "auto"
// ) {
//     // 项目类型
//     let projectType = type
//     // 根据包是否存在 index.html,自动判断类型
//     if (projectType === "auto") {
//         const htmlPath = path.join(process.cwd(), "index.html")
//         projectType = fs.existsSync(htmlPath) ? "application" : "library"
//     }

//     switch (projectType) {
//         // case "application": {
//         //     return defineApplicationConfig(userConfigPromise)
//         // }
//         case "library": {
//             return defineLibraryConfig(userConfigPromise)
//         }
//         default: {
//             throw new Error(`Unsupported project type: ${projectType}`)
//         }
//     }
// }

// export * from "./application"
// export * from "./library"

/*
import { existsSync } from 'node:fs';

function defineConfig(
  userConfigPromise?: DefineConfig,
  type: 'application' | 'auto' | 'library' = 'auto',
) {


  switch (projectType) {
    case 'application': {
      return defineApplicationConfig(userConfigPromise);
    }
    case 'library': {
      return defineLibraryConfig(userConfigPromise);
    }
    default: {
      throw new Error(`Unsupported project type: ${projectType}`);
    }
  }
}

export { defineConfig };
*/
export {};
